<extend name="Layout/ins_popup" />
<block name="content">
	<div class="popup-frame">
		<div class="popup-header">
			<div class="pull-left">
				<h1>{$vo.name}</h1>
			</div>
			<div class="pull-right">
				<a id="btn_close" class="btn btn-cancel">关闭</a>
			</div>
		</div>
		<div class="popup-body">
			<div class="popup-body-scroll">
				<div class="popup-content">
					<div class="oprator-panel" style="background: #FFFFFF">
						<notempty name="prev">
							<a onclick="prev();" class="btn">上一个</a>
						</notempty>
						<notempty name="next">
							<a onclick="next();" class="btn">下一个</a>
						</notempty>
						<div class="split"></div>
						<php>
							if(($auth['admin'])&&($vo['type'] ==1)){
							echo "<a onclick='edit();' class='btn'>编辑</a>";
							echo "<a onclick='del();' class='btn btn-del'>删除</a>";
							}else if($auth['write']&&$vo['type'] ==2){
							echo "<a onclick='edit();' class='btn '>编辑</a>";
							echo "<a onclick='del();' class='btn btn-del'>删除</a>";
							}else if($auth['read']&&$vo['type'] ==3&&$vo['user_id']==get_user_id()){
							echo "<a onclick='edit();' class='btn '>编辑</a>";
							echo "<a onclick='del();' class='btn btn-del'>删除</a>";
							echo "&nbsp";
							};
						</php>
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label" >开始:</label>
					<div class="layui-input-block">
						<p class="layui-input-static">
							{$vo.start_time|substr=0,16}
						</p>
					</div>
				</div>
				<div class="layui-form-item">
					<label class="col-xs-4 layui-form-label" for="name">结束:</label>
					<div class="layui-input-block">
						<p class="layui-input-static">
							{$vo.end_time|substr=0,16}
						</p>
					</div>
				</div>
				<div class="layui-form-item">
					<label class="col-xs-4 layui-form-label" for="name">地点:</label>
					<div class="layui-input-block">
						<p class="layui-input-static">
							{$vo.location}
						</p>
					</div>
				</div>
				<div class="layui-form-item">
					<label class="col-xs-4 layui-form-label" for="name">类型:</label>
					<div class="layui-input-block">
						<p class="layui-input-static">
							<eq name='vo.type' value='3'>
								个人日程
							</eq>
							<eq name='vo.type' value='2'>
								部门日程
							</eq>
							<eq name='vo.type' value='1'>
								公司日程
							</eq>
						</p>
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label" for="name">参与人员:</label>
					<div class="layui-input-block">
						<p class="layui-input-static">
							{$vo.actor}
						</p>
					</div>
				</div>
				<div class="layui-form-item">
					<div class="">
						<div class="content-wrap" >
							{$vo.content}
						</div>
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label" for="name">附件:</label>
					<div class="layui-input-block">
						{:W('FileUpload/view',array('add_file'=>$vo['add_file']))}
					</div>
				</div>
			</div>
		</div>
	</div>
</block>
<block name="js">
	<script type="text/javascript">
		var index = parent.layer.getFrameIndex(window.name);
		layui.use(['global'], function() {
			var $ = layui.jquery;

			var layer = layui.layer;
			//保存后关闭
			$('#btn_save').on('click', function() {
				send_form('form_data', '{:U("save")}', '', function(ret) {
					if (ret.status == 1) {
						parent.layer.msg(ret.info);
						parent.layer.close(index);
						parent.location.reload(true);
					} else {
						parent.layer.msg(ret.info);
						return false;
					}
				});
			});

			//关闭iframe
			$('#btn_close').click(function() {
				parent.layer.close(index);
			});

			$('#btn_select_pid').on('click', function() {
				winopen("{:U('winpop')}", 560, 470);
			});
		});

		function edit() {
			parent.window.location.href = '{:U("edit","id=".$vo["id"])}';
			parent.layer.close(index);
		};

		function del() {
			parent.window.location.href = '{:U("del","id=".$vo["id"])}';
			parent.layer.close(index);
		};

		function next() {
			window.location.href = "{:U('read','id='.$next.'&list='.$list)}";
		};

		function prev() {
			window.location.href = "{:U('read','id='.$prev.'&list='.$list)}";
		};
	</script>
</block>
